using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class WhatsubjectfilterAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public WhatsubjectfilterAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v231] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"ADV","ANU","APA","APM","APN","APP","ARN","CAN","DEM","FIN","GOL","MRI","MRO","NCK","NSC","NST","ORD","OTH","PRB","PRO","RAR","RDR","RER","RES","RGR","ROR","STA","VXI"};
						validVersionCodes[HL7Version.v231] = new string[]{"ADV","ANU","APN","APP","ARN","APM","APA","CAN","DEM","FIN","GOL","MRI","MRO","NCK","NSC","NST","ORD","OTH","PRB","PRO","RES","RAR","RER","RDR","RGR","ROR","SAL","SBK","SBL","SOP","SSA","SSR","STA","VXI"};
						validVersionCodes[HL7Version.v24] = new string[]{"ADV","ANU","APN","APP","ARN","APM","APA","CAN","DEM","FIN","GID","GOL","MRI","MRO","NCK","NSC","NST","ORD","OTH","PRB","PRO","RES","RAR","RER","RDR","RGR","ROR","SAL","SBK","SBL","SOP","SSA","SSR","STA","VXI","XID","SOF"};
						validVersionCodes[HL7Version.v25] = new string[]{"ADV","ANU","APN","APP","ARN","APM","APA","CAN","DEM","FIN","GID","GOL","MRI","MRO","NCK","NSC","NST","ORD","OTH","PRB","PRO","RES","RAR","RER","RDR","RGR","ROR","SAL","SBK","SBL","SOF","SOP","SSA","SSR","STA","VXI","XID"};
						validVersionCodes[HL7Version.v251] = new string[]{"ADV","ANU","APN","APP","ARN","APM","APA","CAN","DEM","FIN","GID","GOL","MRI","MRO","NCK","NSC","NST","ORD","OTH","PRB","PRO","RES","RAR","RER","RDR","RGR","ROR","SAL","SBK","SBL","SOF","SOP","SSA","SSR","STA","VXI","XID"};
						validVersionCodes[HL7Version.v26] = new string[]{"ADV","ANU","APN","APP","ARN","APM","APA","CAN","DEM","FIN","GID","GOL","MRI","MRO","NCK","NSC","NST","ORD","OTH","PRB","PRO","RES","RAR","RER","RDR","RGR","ROR","SAL","SBK","SBL","SOF","SOP","SSA","SSR","STA","VXI","XID"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Advice/diagnosis","Nursing unit lookup (returns patients in beds, excluding empty beds)","Account number query, return matching visit","Medical record number query, returns visits for a medical record number","Patient name lookup","Physician lookup","Nursing unit lookup (returns patients in beds, including empty beds)","Cancel.  Used to cancel a query","Demographics","Financial","Goals","Most recent inpatient","Most recent outpatient","Network clock","Network status change","Network statistic","Order","Other","Problems","Procedure","Pharmacy administration information","Pharmacy dispense information","Pharmacy encoded order information","Result","Pharmacy give information","Pharmacy prescription information","Status","Vaccine Information"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Advice/diagnosis","Nursing unit lookup (returns patients in beds, excluding empty beds)","Patient name lookup","Physician lookup","Nursing unit lookup (returns patients in beds, including empty beds)","Medical record number query, returns visits for a medical record number","Account number query, return matching visit","Cancel.  Used to cancel a query","Demographics","Financial","Goals","Most recent inpatient","Most recent outpatient","Network clock","Network status change","Network statistic","Order","Other","Problems","Procedure","Result","Pharmacy administration information","Pharmacy encoded order information","Pharmacy dispense information","Pharmacy give information","Pharmacy prescription information","All schedule related information, including open slots, booked slots, blocked slots","Booked slots on the identified schedule","Blocked slots on the identified schedule","Open slots on the identified schedule","Time slots available for a single appointment","Time slots available for a recurring appointment","Status","Vaccine Information"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Advice/diagnosis","Nursing unit lookup (returns patients in beds, excluding empty beds)","Patient name lookup","Physician lookup","Nursing unit lookup (returns patients in beds, including empty beds)","Medical record number query, returns visits for a medical record number","Account number query, return matching visit","Cancel.  Used to cancel a query","Demographics","Financial","Generate new identifier","Goals","Most recent inpatient","Most recent outpatient","Network clock","Network status change","Network statistic","Order","Other","Problems","Procedure","Result","Pharmacy administration information","Pharmacy encoded order information","Pharmacy dispense information","Pharmacy give information","Pharmacy prescription information","All schedule related information, including open slots, booked slots, blocked slots","Booked slots on the identified schedule","Blocked slots on the identified schedule","Open slots on the identified schedule","Time slots available for a single appointment","Time slots available for a recurring appointment","Status","Vaccine Information","Get cross-referenced identifiers","First open slot on the identified schedule after the start date/time"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Advice/diagnosis","Nursing unit lookup (returns patients in beds, excluding empty beds)","Patient name lookup","Physician lookup","Nursing unit lookup (returns patients in beds, including empty beds)","Medical record number query, returns visits for a medical record number","Account number query, return matching visit","Cancel.  Used to cancel a query","Demographics","Financial","Generate new identifier","Goals","Most recent inpatient","Most recent outpatient","Network clock","Network status change","Network statistic","Order","Other","Problems","Procedure","Result","Pharmacy administration information","Pharmacy encoded order information","Pharmacy dispense information","Pharmacy give information","Pharmacy prescription information","All schedule related information, including open slots, booked slots, blocked slots","Booked slots on the identified schedule","Blocked slots on the identified schedule","First open slot on the identified schedule after the start date/tiem","Open slots on the identified schedule between the begin and end of the start date/time range","Time slots available for a single appointment","Time slots available for a recurring appointment","Status","Vaccine Information","Get cross-referenced identifiers"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Advice/diagnosis","Nursing unit lookup (returns patients in beds, excluding empty beds)","Patient name lookup","Physician lookup","Nursing unit lookup (returns patients in beds, including empty beds)","Medical record number query, returns visits for a medical record number","Account number query, return matching visit","Cancel.  Used to cancel a query","Demographics","Financial","Generate new identifier","Goals","Most recent inpatient","Most recent outpatient","Network clock","Network status change","Network statistic","Order","Other","Problems","Procedure","Result","Pharmacy administration information","Pharmacy encoded order information","Pharmacy dispense information","Pharmacy give information","Pharmacy prescription information","All schedule related information, including open slots, booked slots, blocked slots","Booked slots on the identified schedule","Blocked slots on the identified schedule","First open slot on the identified schedule after the start date/tiem","Open slots on the identified schedule between the begin and end of the start date/time range","Time slots available for a single appointment","Time slots available for a recurring appointment","Status","Vaccine Information","Get cross-referenced identifiers"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Advice/diagnosis","Nursing unit lookup (returns patients in beds, excluding empty beds)","Patient name lookup","Physician lookup","Nursing unit lookup (returns patients in beds, including empty beds)","Medical record number query, returns visits for a medical record number","Account number query, return matching visit","Cancel.  Used to cancel a query","Demographics","Financial","Generate new identifier","Goals","Most recent inpatient","Most recent outpatient","Network clock","Network status change","Network statistic","Order","Other","Problems","Procedure","Result","Pharmacy administration information","Pharmacy encoded order information","Pharmacy dispense information","Pharmacy give information","Pharmacy prescription information","All schedule related information, including open slots, booked slots, blocked slots","Booked slots on the identified schedule","Blocked slots on the identified schedule","First open slot on the identified schedule after the start date/tiem","Open slots on the identified schedule between the begin and end of the start date/time range","Time slots available for a single appointment","Time slots available for a recurring appointment","Status","Vaccine Information","Get cross-referenced identifiers"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
